package com.qiangqiang.repository;

import com.qiangqiang.entity.Late;
import org.springframework.data.domain.Page;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.query.Procedure;
import org.springframework.data.repository.query.Param;

import java.util.Date;
import java.util.List;

/**
 * Created by q on 2018/2/1.
 */
public interface LateReposity extends JpaRepository<Late, Integer> {
    /**
     * 加一条记录
     */
    @Procedure(name = "insert_late")
    void insertLate(@Param("scoreId") String scoreId, @Param("sId") String sId);

    //TODO
    //删除一条记录

    /**
     * 根据时间段查询记录
     *
     * @param startTime
     * @param finishTime
     * @return
     */
    @Query(value = "select * from late where time>?1 and time<?2", nativeQuery = true)
    List<Late> queryByTimeQuantum(String startTime, String finishTime);
    //分页查询所有记录

    /**
     * 根据学号查询是否有晚归记录
     *
     * @param sId
     * @return
     */
    List<Late> queryBySId(String sId);
}
